<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="layui/jquery-3.2.1.min.js"></script>
    <script src="layui/jquery.query.js"></script>
    <script>
        $(function () {
           var str = $.query.get("info");
           if(str != null && str == "nologin"){
               $("#errorSpan").html("请先登陆");
           }
           else if(str != null && str == "loginerror"){
               $("#errorSpan").html("登陆失败");
           }
        });


        // function login() {
        //     $.post("/user/login",$("#f1").serialize(),function (info) {
        //         if(info == "no"){
        //             $("#errorSpan").html("登陆失败");
        //         }
        //         else{
        //             //将info数据转化为json对象
        //             var userObj = JSON.parse(info);
        //             if("顾客" == userObj.grade){
        //                 location.href = "/html/index.html";
        //             }
        //             else if("管理员" == userObj.grade){
        //                 location.href = "/html/manager/managerIndex.html";
        //             }
        //             else if("送货员" == userObj.grade){
        //                 location.href = "/html/send/sendIndex.html";
        //             }
        //         }
        //     });
        // }
    </script>
</head>
<body>
    <span id="errorSpan" style="color:red;"></span>
    <form id="f1" action="/user/login">
        用户名ww：<input type="text" name="userName"><br>
        密码：<input type="password" name="pwd"><br>
        <input type="submit" value="登陆" >
    </form>
</body>
</html>